//	--------------------------------------------------------------------
//	Copyright(C) 2006,2007 Zhao Yukun. All rights reserved.
//	This file is a part of the Xeres system.
//	Xeres 2007
//	Contact : xeres.engine@gmail.com
//	$(reservedInfo)
//	$(reservedDeclaration)
//	--------------------------------------------------------------------
///	@file	<IShader.h>
///	@path	~/src/graphics/
///	@date	2009/01/10
///	@desc	Shader interface.

#pragma once

#include "xeres.h"

#include "graphics/IDevice.h"
#include "graphics/IShaderVariable.h"
#include "graphics/RenderContext.h"

namespace xeres {

	// forward declaration
	class IGeometry;

	/*! 
		\class	IShader
		\brief	
	*/
	class IShader : public IObject
	{
	public:

		/// \ctor
		IShader( void );

		/// \dtor
		virtual ~IShader( void );

		DECL_IOBJECT_INTERFACE( IShader , IObject );

	public:

		/// \name	Shader Interface
		//@{

		/*!
			\brief		Get shader variable count.
		*/
		virtual size_t GetVariableCount( void ) = 0;

		/*!
			\brief		Get shader variable by index.
		*/
		virtual RefPass< IShaderVariable > GetVariableByIndex( size_t index ) = 0;

		/*!
			\brief		Get shader variable by name.
		*/
		virtual RefPass< IShaderVariable > GetVariableByName( const AString& name ) = 0;

		/*! 
			\brief		Get shader variable by semantic.
		*/
		virtual RefPass< IShaderVariable > GetVariableBySemantic( const AString& semantic ) = 0;

		/*! 
			\brief		Begin shader.
		*/
		virtual void Begin( uint pass , RenderContext& rc ) = 0;

		/*! 
			\brief		End shader, return pass count. If pass is 0, no more pass is needed.
		*/
		virtual void End( uint& pass , RenderContext& rc ) = 0;

		/*! 
			\brief		Draw by shader call.
		*/
		virtual void Draw( RenderContext& rc , RefWeak<IGeometry> geometry ) = 0;

		//@}
	};
	
} // namespace xeres
